import request from '@/request/index.js'

const zhpt = 'zhpt' //http://101.42.107.47:30018文档

//获取科技政策列表
export const getPolicyListApi = (data) => {
    return request({
        url: `/api/${zhpt}/policy/console/search`,
        method: 'POST',
        data,
    })
}

//科技政策类型字典
export const getPolicyTypeApi = () => {
    return request({
        url: `/api/${zhpt}/policy/dict`,
        method: 'GET',
    })
}

//科技政策新增
export const policyAddApi = (data) => {
    return request({
        url: `/api/${zhpt}/policy/add`,
        method: 'POST',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
        },
        data,
    })
}

//科技政策编辑
export const policyEditApi = (data) => {
    return request({
        url: `/api/${zhpt}/policy/edit`,
        method: 'POST',
        data,
    })
}

//科技政策批量操作
export const policyBatchApi = (data) => {
    return request({
        url: `/api/${zhpt}/policy/batch`,
        method: 'POST',
        data,
    })
}

//通过id查询科技政策详情
export const getPolicyDetailsByIdApi = (params) => {
    return request({
        url: `/api/${zhpt}/policy/search/info`,
        method: 'GET',
        params,
    })
}

//通过附件id返回文件流
export const getFileFlowByIdApi = (params) => {
    return request({
        url: `/api/${zhpt}/files/download/fileId`,
        method: 'GET',
        params,
        responseType: 'blob',
    })
}

//删除附件
export const delFileApi = (params) => {
    return request({
        url: `/api/${zhpt}/files/del`,
        method: 'GET',
        params,
    })
}